Interface sjl.Predicate2
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface sjl.Predicate2

public interface Predicate2
extends Object
Defines the interface for predicate objects that takes two parameter. A predicate object is an object that can understand the compare(Object, Object) message. It * is a special case of function objects. A predicate's compare() always returns a boolean whereas a function object's perform() return an Object.
Predicates are typically used by the Algorithms for sorting, ex: sort. You must implement the actual function object with code like this:
    public class IsLess implements Predicate2 {
        public boolean compare(Object o1, Object o2) {
            return o1.equals(o2);
        }
    }

Copyright © 1996 Finn Bock

See Also:
Predicate1

Method Index

 o compare(Object, Object)
This method is executed for each call to the function object.

Methods

 o compare
  public abstract boolean compare(Object o1,
                                  Object o2)
This method is executed for each call to the function object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index